import Vue from 'vue'
import App from './App'
import router from './router'
import { RouterMount } from 'uni-simple-router'
import store from './store'
import { http } from './api/request'
import api from './api/index'
import { showModal, showLoading, hideLoading, showTipsToast, showSuccessToast, showErrorToast } from '@/common/utils'
import { BASE_URL } from '@/store/constant'

Vue.config.productionTip = false

Vue.prototype.$store = store
Vue.prototype.$http = http
Vue.prototype.$api = api
Vue.prototype.$BASE_URL = BASE_URL
Vue.prototype.$showLoading = showLoading
Vue.prototype.$hideLoading = hideLoading
Vue.prototype.$showModal = showModal
Vue.prototype.$showTipsToast = showTipsToast
Vue.prototype.$showSuccessToast = showSuccessToast
Vue.prototype.$showErrorToast = showErrorToast

/** ----- 注册全局组件 ----- Start */
import lazyImg from '@/components/lazy-img/lazy-img'
import simpleAddress from "@/components/simple-address/simple-address.nvue"
Vue.component('lazy-img', lazyImg)
Vue.component('simple-address', simpleAddress)
/** ----- 注册全局组件 ----- End */

App.mpType = 'app'

const app = new Vue({
  ...App
})

//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
RouterMount(app,'#app');
// #endif

// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
